/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.awt.Image;
import java.util.List;
import javax.faces.context.FacesContext;

/**
 *
 * @author amkreuz
 */
public class PropertyBean {

    private String address, city, state, description, email;
    private int zip, price, acre, bedrooms, bathrooms, halfbaths;
    private List<String> images;
    private boolean isHighlight, isPurchased;
    private List<ImageBean> imageList;

    public String getEmail() {
        return email;
    }

    public String getImage() {
        String result = "";
        result += address.replaceAll("\\W", "");
        result += "-"+zip+"/1";
        return result;
    }

    public List<ImageBean> getImageList() {
        return imageList;
    }

    public void setImageList(List<ImageBean> imageList) {
        this.imageList = imageList;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public int getBathrooms() {
        return bathrooms;
    }

    public void setBathrooms(int bathrooms) {
        this.bathrooms = bathrooms;
    }

    public int getHalfbaths() {
        return halfbaths;
    }

    public void setHalfbaths(int halfbaths) {
        this.halfbaths = halfbaths;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getZip() {
        return zip;
    }

    public void setZip(int zip) {
        this.zip = zip;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getAcre() {
        return acre;
    }

    public void setAcre(int acre) {
        this.acre = acre;
    }

    public int getBedrooms() {
        return bedrooms;
    }

    public void setBedrooms(int bedrooms) {
        this.bedrooms = bedrooms;
    }

    public boolean isIsHighlight() {
        return isHighlight;
    }

    public void setIsHighlight(boolean isHighlight) {
        this.isHighlight = isHighlight;
    }

    public boolean isIsPurchased() {
        return isPurchased;
    }

    public String getStatus() {
        String result = "For Sale";
        if (isPurchased) {
            result = "Not For Sale";
        }
        return result;
    }

    public void setIsPurchased(boolean isPurchased) {
        this.isPurchased = isPurchased;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getResponse() {
        //PropertyBean bean = (PropertyBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("prop1");
        FarmBean fb = (FarmBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("user");
        fb.setCurrentProperty(this);
        String status = "For Sale";
        if (isPurchased) {
            status = "Sold";
        }
        String response = "";
        response += "<h2>" + address + "</h2><br/>";
        response += "<h3>Located in " + city + ", " + state + " " + zip + "</h3><br/><br/>";
        response += "<h3>Valued at $" + price + "</h3><br/>";
        response += "<p>Acres: " + acre + "<br>Description: " + description + "</p>";
        response += "Status: <b>" + status + "</b>!<br/>";

        fb.setReponse(response);
        return "PropertyPage.xhtml";
    }
}
